/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myprogramjwz;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author terry
 */
public class MyProgramjwz {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        try {
        String env = System.getenv("TestEnviron");
        System.out.println(env);
        Properties prop = new Properties();
        
        System.out.println(args[0]);
        prop.setProperty(args[0], args[1]);
        prop.setProperty(args[2], args[3]);
        prop.setProperty("Nee", "varproperty2"); 
    	//save properties to project root folder
    	prop.store(new FileOutputStream("jwz.properties"), null);
        }
        
        catch (IOException ex) {
    		ex.printStackTrace();
        }
        
        
        try {
            Properties prop2 = new Properties();
               //load a properties file
    		prop2.load(new FileInputStream("jwz.properties"));
 
               //get the property value and print it out
                System.out.println(prop2.getProperty("Nee"));
                System.out.println(prop2.getProperty("prop1"));
                System.out.println(prop2.getProperty("prop2"));
 
    	} catch (IOException ex) {
    		ex.printStackTrace();
        }
    }
}
